<template>
	<view class="parent-view">
		<text class="title-txt">姓氏文化</text>
		<view class="item">
			<text class="item-txt"  @click="clickXS">中华姓氏</text>
			<text class="item-txt" style="margin-left: 44rpx;" @click="clickJB">祭拜寻根</text>
		</view>
		<text class="title-txt" style="margin-top: 60rpx;">家谱</text>
		<view class="item">
			<text class="item-txt" @click="clickZL">家谱展览</text>
			<text class="item-txt" style="margin-left: 44rpx;" @click="clickCJ">创建家谱</text>
			<text class="item-txt"style="margin-left: 44rpx;" @click="clickJNR">纪念日</text>
		</view>
		<view class="item">
			<text class="item-txt"style="margin-left: 44rpx;" @click="clickDuiHuan">兑换</text>
		</view>
		<text class="title-txt" style="margin-top: 60rpx;">聊天</text>
		<view class="item">
			<text class="item-txt" @click="clickTXL">通讯录</text>
			<button class="item-txt" style="margin-left: 44rpx;" open-type="share"  @click="clickYQ">邀请朋友</button>
		</view>
		<LoginTipDialog :isShow="isShowLoginTip" dataSource="登录查看具体信息"  @returnLoginTipDialog="returnLoginTipDialog"/>
		<exchangeMembersPop :isShow="isShowExchangeMembers" @returnExchangeMembers="returnExchangeMembers"/>
	</view>
</template>

<script>
	import request from '../index/request.js';
	import LoginTipDialog from "@/components/login-tip-dialog/login-tip-dialog.vue";
	import exchangeMembersPop from "@/components/exchange-members-pop/exchange-members-pop.vue";
	
	export default {
		components: {
			LoginTipDialog,exchangeMembersPop
		},
		data() {
			return {
				isShowLoginTip:false,
				isShowExchangeMembers:false,
			}
		},
		methods: {
			onShow:function(){
				this.share.url= '/pages/tabBar/home/index?appInviteId='+this.appUtil.getAppInviteId()
				this.share.shareType=1
				this.loginState()
			},
			onLoad:function(options){
				this.appUtil.saveAppInviteId(options)
			},
			loginState:function(){
				var user = uni.getStorageSync("shiqin-user")
				if (!user.PQD) {
					this.isShowLoginTip=true
					return true
				}
				return false
			},
			returnLoginTipDialog:function(e){
				this.isShowLoginTip=e.isclose
				if(e.tag){
					uni.navigateTo({
						url:"../index/index"
					})
				}
			},
			clickXS:function(){
				//中华姓氏
				uni.navigateTo({
					url: '/pages/surnames/index'
				})
			},
			clickJB:function(){
				uni.navigateTo({
					url: '/pages/his-roots/index'
				})
			},
			clickZL:function(){
				uni.navigateTo({
					url: '/pages/jiapu-show/index'
				})
			},
			clickCJ:function(){
				uni.navigateTo({
					url: '/pages/creat-tree/index'
				})
			},
			clickJNR:function(){
				uni.navigateTo({
					url: '/pages/memorial-day/index'
				})
			},
			clickDuiHuan:function(){
				if(this.loginState()){
					return
				}
				this.isShowExchangeMembers=true
			},
			returnExchangeMembers:function(e){
				this.isShowExchangeMembers=e.isclose
				if(e.tag){
					var that=this
					request.post("api/user/usecoupon",{
						coupon:e.inputStr
					}).then(data=>{
						uni.showToast({
							title:"兑换成功",
							icon:"none"
						})
					})
				}
			},
			clickTXL:function(){
				uni.navigateTo({
					url: '/pages/linkman/index'
				})
			},
			clickYQ:function(){
				uni.share({
				    provider: 'weixin',
				    scene: "WXSceneSession",
				    type: 5,
				    imageUrl: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/d8590190-4f28-11eb-b680-7980c8a877b8.png',
				    title: '欢迎您来到拾亲家谱',
				    miniProgram: {
				        id: 'wxdad1584013b6c691',
				        path: '/pages/tabBar/home/index',
				        type: 0,
						webUrl: 'https://www.baidu.com'
				    },
				    success: ret => {
				    },
					fail: ret => {
					}
				});
			},
			
		}
	}
</script>

<style>
	@import "index.css";
</style>
